use futures;
use reqwest;
use std::error::Error;
use tokio::io::AsyncWriteExt;
use tokio::net::TcpStream;
async fn test() -> Result<u16, Box<dyn Error>> {
    let res = reqwest::Client::new()
        .get("https://hyper.rs")
        .send()
        .await?;
    println!("Status: {}", res.status());
    Ok(res.status().into())
}
#[tokio::main]
pub async fn main() -> Result<(), Box<dyn Error>> {
    // Open a TCP stream to the socket address.
    //
    // Note that this is the Tokio TcpStream, which is fully async.
    // let mut stream = TcpStream::connect("https://hyper.rs").await?;
    // println!("created stream");

    let a = test();
    let b = test();

    let c = futures::join!(a, b);
    let d = c.0.unwrap();
    println!("Status Code u16: {}", d);
    // let result = stream.write(b"hello world\n").await;
    // println!("wrote to stream; success={:?}", result.is_ok());

    Ok(())
}
